package org.secangkirkopipanas.gxtcore.server.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import net.sf.hibernate4gwt.pojo.java5.LazyPojo;

import org.secangkirkopipanas.gxtcore.domain.ISystemApplication;

@Entity
@Table(name = "sys_app")
public class SystemApplication extends LazyPojo implements Serializable,
		ISystemApplication {

	private static final long serialVersionUID = 1L;

	public static final long SYSTEM_APP_ID = 1L;

	@Id
	@Column(name = "id", nullable = false, insertable = true, updatable = true)
	@GeneratedValue(strategy = GenerationType.AUTO)
	private long id;

	@Column(name = "app_name", length = 50, nullable = false, insertable = true, updatable = true)
	private String name;

	@Column(name = "command_name", length = 100, nullable = false, insertable = true, updatable = true)
	private String commandName;

	public SystemApplication() {
	}

	public SystemApplication(long id, String name) {
		this.id = id;
		this.name = name;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCommandName() {
		return commandName;
	}

	public void setCommandName(String commandName) {
		this.commandName = commandName;
	}

	public boolean isTheSystem() {
		return (id == SYSTEM_APP_ID);
	}

}
